﻿using System.Windows.Input;

namespace RG.Common.WPF
{
    /// <summary>
    /// Класс для хранения собственных команд, которых нет в стандартных
    /// </summary>
    public class CustomCommands
    {
        private static readonly RoutedUICommand refresh;
        private static readonly RoutedUICommand newDoc;
        private static readonly RoutedUICommand editDoc;
        private static readonly RoutedUICommand closeDoc;


        static CustomCommands()
        {
            var inputs = new InputGestureCollection {new KeyGesture(Key.F5, ModifierKeys.None, "F5")};
            refresh = new RoutedUICommand("Refresh", "Refresh", typeof(CustomCommands), inputs);

            var newDocInputs = new InputGestureCollection { new KeyGesture(Key.Insert, ModifierKeys.None, "Insert") };
            newDoc = new RoutedUICommand("NewDoc", "NewDoc", typeof(CustomCommands), newDocInputs);

            var editInputs = new InputGestureCollection { new KeyGesture(Key.F4, ModifierKeys.None, "F4") };
            editDoc = new RoutedUICommand("EditDoc", "EditDoc", typeof(CustomCommands), editInputs);

            var closeInputs = new InputGestureCollection { new KeyGesture(Key.F8, ModifierKeys.None, "F8") };
            closeDoc = new RoutedUICommand("CloseDoc", "CloseDoc", typeof(CustomCommands), closeInputs);
        }

        /// <summary>
        /// Команда для обновления фреймов, прибиндена к клавише F5
        /// </summary>
        public static RoutedUICommand Refresh { get { return refresh; } }
        /// <summary>
        /// Команда создания нового документа, прибиндена к клавише Insert
        /// </summary>
        public static RoutedUICommand NewDoc { get { return newDoc; } }
        /// <summary>
        /// Команда редактирования,  прибиндена к клавише F4
        /// </summary>
        public static RoutedUICommand EditDoc { get { return editDoc; } }
        /// <summary>
        /// Команда закрытия документа,  прибиндена к клавише F8
        /// </summary>
        public static RoutedUICommand CloseDoc { get { return closeDoc; } }
    }
}
